package main

import (
	"bufio"
	"fmt"
	"os"
)

//dup 输出标准输入中出现次数大于 1 的行，前面是次数

func main() {
	counts := make(map[string]int)
	input := bufio.NewScanner(os.Stdin)

	for input.Scan() {
		if input.Text() == "" {
			break
		}
		counts[input.Text()]++
	}
	//PS: 忽略input.Err()中可能的错误
	for line, n := range counts {
		fmt.Println(n, line)
	}
}
